package com.knife.hospital.util.user;

import com.knife.hospital.entity.UserPO;
import com.knife.hospital.entity.CommonUserPO;
import com.knife.hospital.model.user.UserRegisterResponse;
import com.knife.hospital.model.user.UserRegisterRequest;
import org.springframework.stereotype.Component;

/**
 * @author Zhenghao Ji
 */
@Component
public class UserRegisterUtil {
    public UserPO UserRegisterRequestToUserPo(UserRegisterRequest userRegisterRequest) {
        UserPO userPO = new UserPO();
        userPO.setNickname(userRegisterRequest.getNickname());
        userPO.setPassword(userRegisterRequest.getPassword());
        userPO.setReserved(userRegisterRequest.getReserved());
        userPO.setType(userRegisterRequest.getType());
        return userPO;
    }
    public CommonUserPO UserRegisterRequestToCommonUserPo(UserRegisterRequest userRegisterRequest) {
        CommonUserPO commonUserPO = new CommonUserPO();
        commonUserPO.setName(userRegisterRequest.getNickname());
        commonUserPO.setGender(userRegisterRequest.getGender());
        commonUserPO.setEmail(userRegisterRequest.getEmail());
        commonUserPO.setPhone(userRegisterRequest.getPhone());
        commonUserPO.setReserved(userRegisterRequest.getReserved());
        return commonUserPO;
    }
    public UserRegisterResponse userPoToUserResponse(UserPO userPO) {
        UserRegisterResponse userRegisterResponse = new UserRegisterResponse();
        userRegisterResponse.setId(userPO.getId());
        userRegisterResponse.setNickname(userPO.getNickname());
        userRegisterResponse.setType(userPO.getType());
        userRegisterResponse.setReserved(userPO.getReserved());
        userRegisterResponse.setState(userPO.getState());
        return userRegisterResponse;
    }

}